<?php if (!defined('THINK_PATH')) exit();?>
 <!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>Bootstrap Admin</title>
    <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <link rel="stylesheet" type="text/css" href="/TPproject/project/Public/Admin/Css/bootstrap.css">
    
    <link rel="stylesheet" type="text/css" href="/TPproject/project/Public/Admin/Css/theme.css">
    <link rel="stylesheet" href="/TPproject/project/Public/Admin/Css/font-awesome.css">

    <script src="/TPproject/project/Public/Admin/Js/jquery-1.7.2.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="/TPproject/project/Public/Admin/Js/layer.js"></script>
    <script type="text/javascript" src="/TPproject/project/Public/Admin/static/h-ui/js/H-ui.min.js"></script>
    <script type="text/javascript" src="/TPproject/project/Public/Admin/static/h-ui.admin/js/H-ui.admin.js"></script>


    <!-- Demo page code -->

    <style type="text/css">
        #line-chart {
            height:300px;
            width:800px;
            margin: 0px auto;
            margin-top: 1em;
        }
        .brand { font-family: georgia, serif; }
        .brand .first {
            color: #ccc;
            font-style: italic;
        }
        .brand .second {
            color: #fff;
            font-weight: bold;
        }
        .table>thead>tr>th
        {
          text-align: center;
        }
        .table>tbody>tr>td
        {
          text-align: center;
        }
    </style>



 
    <link rel="shortcut icon" href="/TPproject/project/Public/Admin/Img/favicon.ico">
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="/TPproject/project/Public/Admin/Img/apple-touch-icon-144-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="/TPproject/project/Public/Admin/Img/apple-touch-icon-114-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="/TPproject/project/Public/Admin/Img/apple-touch-icon-72-precomposed.png">
    <link rel="apple-touch-icon-precomposed" href="/TPproject/project/Public/Admin/Img/apple-touch-icon-57-precomposed.png">
  </head>
        
        

        <div class="container-fluid">
            <div class="row-fluid">
                    
<div class="btn-toolbar">
    <button class="btn btn-primary" id="submit"><i class="icon-save"></i> 提交</button>
    
  <div class="btn-group">
  </div>
</div>
<div class="well">
    
    <div id="myTabContent" class="tab-content">
      <div class="tab-pane active in" id="home">
    <form id="attr" method="post" enctype="multipart/form-data" action="/TPproject/project/index.php/Admin/Proattr/edit">
      <!-- <input class="btn btn-primary" type="submit" id="submit"> -->

        <label>产品名称：<?php echo ($product["pro_name"]); ?></label>
        
        <br/>

        <label>产品类别：<?php echo ($product["catename"]); ?></label>
        
        <br/>


        <label>限购数量</label>
        <input type="number" value="<?php echo ($pro_attr["restrict_nub"]); ?>" class="input-xlarge" id="restrict_nub" name='restrict_nub' >

        <label>封面图片</label>
        <input type="file" name="main_img" id="main_img">
        <br/><br/>
        
        <label>详情图片</label>
        <input type="file" name="detail_img[]" id="detail_img" multiple="">
        <br/><br/>

        <label>详情信息图片</label>
        <input type="file" id="detail_info_img[]" name='detail_info_img'>
        <br/><br/>

        <label>水印类型</label>
        <select name="water_type" id="water_type" class="input-xlarge" style="width:100px">
            <option value="0">无水印</option>
            <option value="1">图片水印</option>
            <option value="2">文字水印</option>
        </select>

        <span class="water">
          
        </span>

        <label>产品材质</label>
        <input type="text" value="<?php echo ($pro_attr["materials"]); ?>" class="input-xlarge" id="materials" name='materials'>

        <label>适用性别</label>
        <input type="radio" value="0" class="input-xlarge"  name='apple_gender'>男
        <span style="display: inline-block; width: 80px;"></span>
        <input type="radio" value="1" class="input-xlarge"  name='apple_gender'>女
        <span style="display: inline-block; width: 80px;"></span>
        <input type="radio" value="2" class="input-xlarge"  name='apple_gender'>中性
        <br/><br/>

        <label>产品货号</label>
        <input type="text" value="<?php echo ($pro_attr["article_number"]); ?>" class="input-xlarge" id="article_number" name='article_number'>

        <label>模特</label>
        <select name="model_id" id="model_id" class="input-xlarge">
          <?php if(is_array($model_list)): $i = 0; $__LIST__ = $model_list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$value): $mod = ($i % 2 );++$i;?><option value="<?php echo ($value["model_id"]); ?>" <?php if($value["model_id"] == $pro_attr['model_id']): ?>selected<?php endif; ?> ><?php echo ($value["model_name"]); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
        </select>

        <label>面料</label>
        <input type="text" value="<?php echo ($pro_attr["lining"]); ?>" class="input-xlarge" id="lining" name='lining'>

     
    </form>
      </div>
      
  </div>

</div>





<script type="text/javascript">
  var water_type = $("#water_type");
  var water = $('.water');
  water_type.change(function(){
    var type = water_type.val();
    if(type==1){
      var pic = '<label>图片水印</label><input type="file" id="water" name="water"><br/><br/>';
      water.html(pic);
    }else if(type==2){
      var text = '<label>文字水印</label><input type="text" id="water" class="input-xlarge" name="water"><br/><br/>';
      water.html(text);
    }else{
      water.html('');
    }
  })

  $("#submit").click(function(){
 
    var fromdata = new FormData($('#attr')[0]);
    // alert(fromdata);return false;
    // for (var i=0;i<ufile.files.length;i++) {
    //   // 在每个匹配元素里面的末尾处插入参数内容
    //   fromdata.append("ufiles[]",ufile.files[i]);
    // }
    $.ajax({
      type:'post',
      url:'/TPproject/project/index.php/Admin/Proattr/edit',
      dataType:'json',
      data:fromdata,
      processData : false,  //必须false才会避开jQuery对 formdata 的默认处理   
      contentType : false,  //必须false才会自动加上正确的Content-Type 
      success:function(msg){
        if(msg.code=='1'){
          
          layer.msg(msg.info,{icon:1,time:1000},function(index){
            window.parent.location.reload();
          });

        }else{
          layer.msg(msg.info,{icon:2,time:1000});
          return false;
        }
      }
    });

  })
   
  
</script>